home *** CD-ROM | disk | FTP | other *** search
- Path: news.sover.net!news
- From: mountain@sover.net (Steve Mount)
- Newsgroups: comp.lang.c
- Subject: Re: A Simple Question From A Beginner (Please Help)
- Date: 17 Mar 1996 14:49:25 GMT
- Organization: SoVerNet, Inc.
- Message-ID: <4ih8pl$680@thrush.sover.net>
- References: <4i26gm$6th@news.bellglobal.com>
- NNTP-Posting-Host: pm0a6.mid.sover.net
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
- In article <4i26gm$6th@news.bellglobal.com>, dlowe@pathcom.com says...
- >
- >
- >This should be a simple thing to execute but for some reason I can not
- >get it to work.
- >
- >
- >What I would like to do is execute something like a SHELL command.
- >What I would like to do in C or C++ is the equivelent to typing the
- >following at the Win NT command line:
- >
- >
- > sendmail dlowe@pathcom.com < mail.txt
- >
- >I have tried the following code:
- >
- > _spawnl( _P_WAIT, "sendmail.exe", "dlowe@pathcom.com < mail.txt",
- > NULL);
- >
- >and
- >
- >
- > args[0] = "child";
- > args[1] = "dlowe@pathcom.com < c:\\notes\\data\\clustrep.txt";
- > args[2] = NULL;
- > args[3] = NULL;
- > .
- > .
- > .
- > _spawnvp( _P_OVERLAY, "c:\\Sendmail\\Sendmail.exe", args );
- >
- >
- >My problem ranges from nothing happends to Sendmail not see the
- >parameters properly.
- >
- >Any help would be greatly appreaciated.
-
- I think your problem is that the redirection is not being interpreted -
- normally the command interpreter (whether command.com or a shell in Unix)
- takes care of the redirection. I think what you want to use is the
- system() function. Try it out. It offers less control, but does spawn
- a command interpreter to take care of your command line, and does the
- redirection, too.
-
- +============================================================================+
- | Steve Mount, Software Engineer Work: sjjm@hawkeye.idx.com |
- | CIS: 73720,3404 MSN: S_Mountain Home: mountain@sover.net |
- | AOL: Mountain |
- | WWW: http://www.sover.net/~mountain/ "Fight, Win, Prevail!" |
- +============================================================================+
-
-